//
//  SYFuntionHeaderView.m
//  SanYiTeaching
//
//  Created by 郑浩然 on 2019/4/19.
//  Copyright © 2019年 SanYi. All rights reserved.
//

#import "SYFuntionHeaderView.h"

@interface SYFuntionHeaderView ()

@property (strong, nonatomic) UIImageView *xlImageView;//下拉箭头view



@end


@implementation SYFuntionHeaderView

- (instancetype)init {
    self = [super init];
    if (self) {
       // self.backgroundColor = [UIColor yellowColor];
        [self initSubView];
    }
    return self;
}

- (void)initSubView {
    [self addSubview:self.titleLab];
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(10);
        make.centerY.equalTo(self.mas_centerY);
        make.width.mas_equalTo(65);
    }];
    [self addSubview:self.contLab];
    [self.contLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLab.mas_right).offset(20);
        make.centerY.equalTo(self.titleLab.mas_centerY);
    }];
    [self addSubview:self.textField];
    [self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLab.mas_right).offset(20);
        make.centerY.equalTo(self.titleLab.mas_centerY);
        make.width.mas_equalTo(150);
        make.height.mas_equalTo(35);
    }];
    
    
    [self addSubview:self.xhxView];
    [self.xhxView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLab.mas_right).offset(10);
        make.top.equalTo(self.textField.mas_bottom).offset(0);
        make.height.mas_equalTo(1);
        make.width.mas_equalTo(250);
    }];
    
    [self addSubview:self.selectView];
    [self.selectView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.titleLab.mas_centerY);
        make.left.equalTo(self.titleLab.mas_right).offset(10);
        make.width.mas_equalTo(253);
        make.height.mas_equalTo(30);
    }];
    
    [self.selectView addSubview:self.timeBtn];
    [self.timeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.equalTo(self.selectView);
        make.left.equalTo(self.selectView.mas_left).offset(20);
        make.right.equalTo(self.selectView.mas_right).offset(-30);
    }];
    
    [self.selectView addSubview:self.xlImageView];
    [self.xlImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.selectView.mas_centerY);
        make.right.equalTo(self.selectView.mas_right).offset(-10);
    }];
    
}


- (UILabel *)titleLab {
    if (!_titleLab) {
        _titleLab = [UILabel titleColour:TITLECOLOR
                              titleFount:15
                                pingfang:@"PingFang-SC-Regular"
                               alignment:NSTextAlignmentRight
                               titleLine:1];
        _titleLab.text = @"开始日期:";
    }
    return _titleLab;
}
- (UILabel *)contLab {
    if (!_contLab) {
        _contLab = [UILabel titleColour:TITLECOLOR
                             titleFount:13
                               pingfang:@"PingFang-SC-Regular"
                              alignment:NSTextAlignmentCenter
                              titleLine:1];
        _contLab.text = @"2019-04-08";
    }
    return _contLab;
}

- (UITextField *)textField {
    if (!_textField) {
        _textField = [[UITextField alloc] init];
        _textField.font = [UIFont systemFontOfSize:13];
        _textField.textColor = TITLECOLOR;
    }
    return _textField;
}

- (UIView *)xhxView {
    if (!_xhxView) {
        _xhxView = [[UIView alloc] init];
        _xhxView.backgroundColor = [UIColor colorWithHexString:@"#999999"];
    }
    return _xhxView;
}
- (UIView *)selectView {
    if (!_selectView) {
        _selectView = [[UIView alloc] init];
        _selectView.layer.borderWidth = 1;
        _selectView.layer.borderColor = [UIColor colorWithHexString:@"#999999"].CGColor;
        _selectView.hidden = YES;
    }
    return _selectView;
}

- (UIButton *)timeBtn {
    if (!_timeBtn) {
        _timeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _timeBtn.titleLabel.font = [UIFont systemFontOfSize:13];
        [_timeBtn setTitleColor:TITLECOLOR forState:UIControlStateNormal];
    }
    return _timeBtn;
}

- (UIImageView *)xlImageView {
    if (!_xlImageView) {
        _xlImageView = [[UIImageView alloc] init];
        _xlImageView.image = [UIImage imageNamed:@"fd_sanJiao"];
    }
    return _xlImageView;
}

@end
